package com.base.monitor.admin.controller.manage;

import com.base.monitor.admin.service.AuthService;
import com.base.monitor.framework.annotation.ResponseResult;
import com.base.monitor.model.model.system.dto.UserLoginDto;
import com.base.monitor.model.model.system.dto.UserPasswordDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/auth")
@ResponseResult
public class AuthController {

    @Autowired
    private AuthService authService;

    /**
     * 用户登录
     * @param dto 登录信息
     * @return
     */
    @PostMapping("/login")
    public void login(UserLoginDto dto) {
        authService.login(dto);
    }

    /**
     * 修改用户密码
     * @param dto 修改密码的实体
     */
    @PostMapping("/editPassword")
    public void editPassword(@RequestBody UserPasswordDto dto) {
        authService.editPassword(dto);
    }
}
